using UnityEngine;

public class LodCamera : MonoBehaviour
{
	public bool fog;

	public Color fogColor;

	public Color ambientLight;

	public float Start;

	public float End;

	private bool previousFog;

	private Color previousFogColor;

	private Color previousAmbientLight;

	private float previousStart;

	private float previousEnd;

	private void OnPreRender()
	{
		previousFog = RenderSettings.fog;
		previousFogColor = RenderSettings.fogColor;
		previousAmbientLight = RenderSettings.ambientLight;
		previousStart = RenderSettings.fogStartDistance;
		previousEnd = RenderSettings.fogEndDistance;
		if (fog)
		{
			RenderSettings.fog = fog;
			RenderSettings.fogColor = fogColor;
			RenderSettings.ambientLight = ambientLight;
			RenderSettings.fogStartDistance = Start;
			RenderSettings.fogEndDistance = End;
		}
	}

	private void OnPostRender()
	{
		RenderSettings.fog = previousFog;
		RenderSettings.fogColor = previousFogColor;
		RenderSettings.ambientLight = previousAmbientLight;
		RenderSettings.fogStartDistance = previousStart;
		RenderSettings.fogEndDistance = previousEnd;
	}
}
